﻿using Shop.RemoteModel.ActivityGoods.Model;
using Shop.StoreGatewayModular.Interface;
using Shop.StoreGatewayModular.Model.ActivityGoods;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Shop.StoreGatewayModular.Api
{
    [ApiRouteName("/shop/activity/goods/{name}")]
    internal class ActivityGoodsApi : ApiController
    {
        private readonly IActivityGoodsService _Service;

        public ActivityGoodsApi (IActivityGoodsService service)
        {
            this._Service = service;
        }

        public void Delete ([NumValidate("shop.activity.goods.id.error", 1)] long id)
        {
            this._Service.Delete(id);
        }

        public ActivityGoodsDto[] Gets ([NumValidate("shop.activity.id.error", 1)] long activityId)
        {
            return this._Service.Gets(activityId);
        }

        public ActivityGoodsDto[] Set (LongParam<ActivityGoods[]> set)
        {
            return this._Service.Set(set.Id, set.Value);
        }
        public void BatchDelete (LongParam<long[]> drop)
        {
            this._Service.Delete(drop.Id, drop.Value);
        }
        public void BatchSetPrice (LongParam<SetPrice[]> obj)
        {
            this._Service.BatchSetPrice(obj.Id, obj.Value);
        }
        public bool SetPrice (SetPriceParam set)
        {
            return this._Service.SetPrice(set.Id, set.Price, set.IsMust);
        }
    }
}
